﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FbKPI.Facade;
using FbKPI.Model;

namespace FBKPI.Forms
{
    public partial class JobPositionForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int ID = Convert.ToInt16(Request.QueryString["ID"]);
                if (ID != 0)
                {
                    JobPositionFacade jf = new JobPositionFacade();
                    JobPosition JobPosition = jf.GetJobPositionByID(ID);

                    if (JobPosition != null)
                    {
                        txt_id.Text = JobPosition.ID.ToString();
                        hfId.Value = JobPosition.ID.ToString();
                        txt_position.Text = JobPosition.Position;
                        txt_jobdescription.Text = JobPosition.JobDescription;
                        chk_active.Checked = JobPosition.isActive;
                        //txt_lastmodifieddate.Text = JobPosition.LastModifiedDate == null ? "" : Convert.ToDateTime(JobPosition.LastModifiedDate).ToShortDateString();
                        //txt_lastmodifiedby.Text = JobPosition.LastModifiedBy;
                        //txt_createdate.Text = JobPosition.CreateDate == null ? "" : Convert.ToDateTime(JobPosition.CreateDate).ToShortDateString();
                        //txt_createby.Text = JobPosition.CreateBy;
                    }
                }
                else
                {
                    txt_id.Text = "0";
                }

                //if (txt_id.Text == "0") btn_delete.Visible = false;
            }
        }
    }
}